package com.lyhengtongwl.zqsnews.adapter;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.lyhengtongwl.zqsnews.R;
import com.lyhengtongwl.zqsnews.entity.WithDrawRecordEntity;
import com.lyhengtongwl.zqsnews.utils.FTYUtils;

import java.util.List;

public class WithDrawRecordAdapter extends BaseQuickAdapter<WithDrawRecordEntity, BaseViewHolder> {
    private Activity activity;

    public WithDrawRecordAdapter(Activity activity, List<WithDrawRecordEntity> newsList) {
        super(R.layout.item_withdrawalrecord, newsList);
        this.activity = activity;
    }


    @SuppressLint("SetTextI18n")
    @Override
    protected void convert(BaseViewHolder helper, WithDrawRecordEntity item) {
        String title = item.getTitle();
        String time = item.getTime();
        String money = item.getMoney();
        ((TextView) helper.getView(R.id.tv_title)).setText("提现");
        ((TextView) helper.getView(R.id.tv_money)).setText( FTYUtils.fenToYuan(money));
        ((TextView) helper.getView(R.id.tv_time)).setText(time);
//        0-审核中，1-已确认，2-已打款,3-已到账
        switch (item.getState()){
            case "-1":
                ((TextView) helper.getView(R.id.tv_state)).setText("已驳回");
                ((TextView) helper.getView(R.id.tv_state)).setTextColor(activity.getResources().getColor(R.color.color666));
                break;
            case "0":
                ((TextView) helper.getView(R.id.tv_state)).setText("审核中");
                ((TextView) helper.getView(R.id.tv_state)).setTextColor(activity.getResources().getColor(R.color.color666));
                break;
            case "1":
                ((TextView) helper.getView(R.id.tv_state)).setText("已确认");
                ((TextView) helper.getView(R.id.tv_state)).setTextColor(activity.getResources().getColor(R.color.color666));
                break;
            case "2":
                ((TextView) helper.getView(R.id.tv_state)).setText("已打款");
                ((TextView) helper.getView(R.id.tv_state)).setTextColor(activity.getResources().getColor(R.color.color666));
                break;
            case "3":
                ((TextView) helper.getView(R.id.tv_state)).setText("已到账");
                ((TextView) helper.getView(R.id.tv_state)).setTextColor(activity.getResources().getColor(R.color.mainBg));
                break;

        }
    }
}
